﻿using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

namespace SFJDManagement
{
	class ITestColumn : DataGridBoundColumn
	{
		protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
		{
			throw new NotImplementedException();
		}

		protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
		{
			Binding binding = Binding as Binding;
			DataGrid g = new DataGrid();
			g.SetBinding(DataGrid.ItemsSourceProperty, binding);


			//Grid grid = new Grid();
			//grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Auto) });
			//grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Auto) });
			//grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Auto) });

			//var block = new TextBlock() { Margin = new Thickness(2, 1, 2, 1) };
			//block.SetBinding(TextBlock.TextProperty, new Binding("Vehicle") { Path = binding.Path, Mode = BindingMode.TwoWay, ElementName = "Number" });
			//Grid.SetColumn(block, 0);
			//grid.Children.Add(block);
			//block = new TextBlock() { Margin = new Thickness(1) };
			//block.SetBinding(TextBlock.TextProperty, new Binding("Brand") { Path = binding.Path, Mode = BindingMode.TwoWay });
			//Grid.SetColumn(block, 1);
			//grid.Children.Add(block);

			//block = new TextBlock() { Margin = new Thickness(2, 1, 2, 1) };
			//block.SetBinding(TextBlock.TextProperty, new Binding("Type") { Path = binding.Path, Mode = BindingMode.TwoWay });
			//Grid.SetColumn(block, 2);
			//grid.Children.Add(block);


			//block = new TextBlock() { Margin = new Thickness(1) };
			//block.SetBinding(TextBlock.TextProperty, new Binding() { Path = binding.Path, Mode = BindingMode.OneWay, Converter = new SmartTimeSeparatorConverter() });
			//Grid.SetColumn(block, 3);
			//grid.Children.Add(block);

			//block = new TextBlock() { Margin = new Thickness(2, 1, 2, 1) };
			//block.SetBinding(TextBlock.TextProperty, new Binding() { Path = binding.Path, Mode = BindingMode.TwoWay, Converter = new TwoDigitsConverter(), ConverterParameter = "s" });
			//Grid.SetColumn(block, 4);
			//grid.Children.Add(block);

			return g;
		}
	}
}
